// ****************************************************************
//
// Logic 6
//
// ****************************************************************

#include "defines.txt"
if (new_room)
{
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  set.horizon(60);

load.view(16);
set.view(o9,16);
set.loop(o9,0);
set.cel(o9,0);
position(o9,25,82);
set.priority(o9,4);
ignore.horizon(o9);
draw(o9);
if(!has("sword")){
animate.obj(o3);
load.view(11);
set.view(o3,11);
set.loop(o3,0);
set.cel(o3,0);
position(o3,132,63);
set.priority(o3,6);
ignore.objs(o3);
stop.cycling(o3);
draw(o3);
animate.obj(o6);
load.view(14);
set.view(o6,14);
set.loop(o6,0);
set.cel(o6,0);
position(o6,100,75);
set.priority(o6,4);
stop.cycling(o6);
ignore.objs(o3);
draw(o6);
}

  //ADD ADDITIONAL INITIALIZATION CODE HERE

  if (prev_room_no == 5)
  {
    position(o0, 2, 110);
  }
  else
  {
  if (prev_room_no == 7)
  {
    position(o0, 157, 125);
  }
  }
  draw(o0);
  show.pic();
}

if (ego_edge_code == left_edge)
{
  //ADD ADDITIONAL LEFT EXIT CODE HERE
  new.room(5);
}

if (ego_edge_code == right_edge)
{
  //ADD ADDITIONAL RIGHT EXIT CODE HERE
  new.room(7);
}
if (f2 && unknown_word_no == 0 && !f2)
{  if (said("look"))
  {
    print("Schiessville the town, starts here. EST. 2002-Population 25");
  }
}

     if(said("speak")) {
     print("Hello, how are you?");
     if(!has("sword")) {
     print("If you give me an apple, I will give you this sword.");
     if (has("apple")) {
     print("Hey you have an apple!");
     if(has("sword")) {
     print("Great! Have a nice day!");
       }
      }
     }
    }


      if (said("give", "apple")) {
      if (posn(o0,86,45,124,96)) {
         if (!has(i4)) {
         if (has(i5)) {
       print("You want to give me that apple? Thank You!");
       print("Do you see that sword over there?");
       print("You may have it!");
       get(i4);
       drop(i5);
       set.cel(o3,1);
       v3 += 3;
      }
      else {
       print("Get closer.");
      }
     }
      else {
       print("What apple?");
     }
    }
   }
      if (said("get","sword")) {
      if (posn(o0,84,45,124,96)) {
      if (!has("sword")) {
          print("You want that sword huh?");
          print("You may have it if you give me a shiny red apple!");
          }
        else {
          print("The sword is not there anymore.");
         }
        }
      else {
       print("Dont get greedy now, get closer.");
     }
    }

return();